<template>
  <div class="screenfull">
    <svg-icon
      id="guide-full"
      :icon="isFullscreen ? 'exit-fullscreen' : 'fullscreen'"
      @click="onToggle"
    />
  </div>
</template>

<script setup>
import { ref, onMounted, onUnmounted } from "vue";
import screenfull from "screenfull";

const isFullscreen = ref(false);
const change = () => {
  isFullscreen.value = screenfull.isFullscreen;
};
const onToggle = () => {
  screenfull.toggle();
};
onMounted(() => {
  screenfull.on("change", change);
});
onUnmounted(() => {
  screenfull.off("change", change);
});
</script>

<style lang="scss" scoped>
.screenfull {
  font-size: 24px;
}
</style>
